how to tune sql in data warehouse